<template>
  <div>
    <div class="left">
      <el-form :inline="true" :model="where" label-position="top">
        <el-form-item>
          <div style="width: 300px"><Daterange @date="date => {where.time = date; model.page(1)}" /></div>
        </el-form-item>
      </el-form>
      <Table :data="model.getList()" />
      <div class="page">
        <el-pagination
          @current-change="model.page"
          :current-page="where.page"
          :page-size="where.page_size"
          layout="total, prev, pager, next, jumper"
          :total="where.page_total"
          background>
        </el-pagination>
      </div>
    </div>
    <div class="right scroll-box">
      <Form />
    </div>
  </div>
</template>

<script>
import app from '@/app'
import model from '../model'
import accountModel from '@/model/account'

import Daterange from '@/components/daterange'
import Table from './table'
import Form from './form'


export default {
  components: {
    Daterange,
    Table,
    Form
  },
  setup() {
    // 条件
    const where = model.data

    // 重置查询条件
    where.value = {
      checkout_id: accountModel.getData().checkout_id
    }

    // 加载列表数据
    model.get()

    return {
      time: app.time,
      money: app.money,
      lang: app.lang,
      plugin: app.plugin.index,
      model,
      where,
    }
  }
}
</script>